Last Updated 10/28/2022

Sage Essentials
Section 3: Graphing

In this section you will learn how to plot the graph of a function defined by an expression. Other topics covered include: combining the graphs of several expressions into a single plot, plotting points, and combining different plot structures into a single picture.

The plot command

Example 1

Let us use the plot command to plot the graph of 2 x 2 3 for 4x4.

Notice that Sage scales the y-axis automatically, choosing a y-scale that shows the entire graph corresponding to the specified domain.

You can override automatic y-scaling by specifying a range for y as well as x. On the next box we have limited the y-range to the interval [-10,30].

Try this! Plot the graph of 3 x 2 for 4x4 . Limited the y-range to the interval [-15,5]. Use red as the color of the graph by inserting the additional option color='red'.


← Previous Example Next Example →